#include "Sock.hpp"

//使用手册
void Usage(std::string proc)
{
    std::cerr << "Usage: " << proc << " port" << std::endl;
}

int main(int argc, char* argv[])
{
    if(argc != 2){
        Usage(argv[0]);
        exit(1);
    }

    //获取监听套接字
    int listen_sockfd = TCPSock::Socket();
    //绑定套接字
    TCPSock::Bind(listen_sockfd, atoi(argv[1]));
    //监听套接字
    TCPSock::Listen(listen_sockfd);
    //获取sockfd
    int sockfd = TCPSock::Accept(listen_sockfd);
    sleep(100);

    //关闭文件描述符
    close(sockfd);
    close(listen_sockfd);
}